home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / telecomm / bbs / tbbs093.lha / Rexx / BBSLogOn.rexx < prev    next >
OS/2 REXX Batch file  |  1994-02-24  |  5KB  |  177 lines

  1. /* A login script for TechnoBBS */
  2.  
  3. CR = D2C(13)
  4. LF = D2C(10)
  5. CRLF = CR||LF
  6. ESC = D2C(27)
  7. ln = arg(1)
  8. LineName = Con_LineActive(ln)
  9. if LineName = "" then LineName = Con_LogOn(ln)
  10. address command
  11. address VALUE LineName
  12. SendASCII "Text/PreLogOn.txt"
  13. UserName = ""
  14. retry = 0
  15. SetTimeLeft 5
  16. LogEntry "Line 1: Connection"
  17. do forever
  18.     SetStatus "Logging on"
  19.     SetUserCharSet "ISO"
  20.     UserName = AskInput(ln, "Enter username: ", "", 36, "CAPITAL")
  21.     if UserName ~= "" then do
  22.         LoadUser UserName
  23.         SendModem CRLF
  24.         if GetUserName(ln) = "" then do
  25.             retry = retry + 1
  26.             IsNew = GetYesNo(ln, UserName||" - is this correct? ", 0, 1)
  27.             SendModem CRLF
  28.             if IsNew = 1 then do
  29.                 SetTimeLeft 30
  30.                 SetStatus "NewUser"
  31.                 SendASCII "Text/NewUser.txt"
  32.                 ClearUser
  33.                 accept = 0
  34.                 do while accept = 0
  35.                     UserName = AskInput(ln, "Enter your full name: ", UserName, 36, "CAPITAL")
  36.                     if Length(UserName) > 4 then do
  37.                         invalid = 0
  38.                         do pos = 1 to Length(UserName)
  39.                             char = substr(UserName, pos, 1)
  40.                             if (datatype(char) = 'NUM') then invalid = 1
  41.                             end
  42.                         if invalid ~= 0 then SendModem CRLF||"Name contains invalid characters"||CRLF||CRLF
  43.                         else do
  44.                             LoadUser UserName
  45.                             if GetUserName(ln) ~= "" then do
  46.                                 ClearUser
  47.                                 SendModem CRLF||"A user by that name already exists!"||CRLF||CRLF
  48.                                 end
  49.                             else accept = 1
  50.                             end
  51.                         end
  52.                     else SendModem CRLF||"Your name must contain at least 5 characters"||CRLF||CRLF
  53.                     end
  54.                 SendModem CRLF
  55.                 call SetUserMisc ln, "ADDRESS", AskInput(ln, "Street address: ", "", 80)
  56.                 call SetUserMisc ln, "CITY", AskInput(ln, "City: ", "", 40)
  57.                 call SetUserMisc ln, "POSTCODE", AskInput(ln, "Postal code: ", "", 40)
  58.                 call SetUserMisc ln, "COUNTRY", AskInput(ln, "Country: ", "", 40)
  59.                 SendModem CRLF
  60.                 call SetUserMisc ln, "VPHONE", AskInput(ln, "Voice number: ", "", 40)
  61.                 call SetUserMisc ln, "DPHONE" , AskInput(ln, "Data number: ", "", 40)
  62.                 SendModem CRLF
  63. /*                SendASCII "Text/StripAll.txt" */
  64. /*                SetStripAll GetYesNo(ln, "Strip All ANSI-Codes? ", 0, 1) */
  65. /*                SendModem CRLF */
  66.                 SendModem CRLF
  67.                 if GetStripAll(ln) = 0 then do
  68. /*                    SendASCII "Text/StripCols.txt" */
  69.                     if GetYesNo(ln, "Would you like to use ANSI-Colors? ", 1, 1) = 1 then SetStripCols 0
  70.                     else SetStripCols 1
  71.                     SendModem CRLF
  72.                     SendModem CRLF
  73.                     SendASCII "Text/InsDel.txt"
  74.                     if GetYesNo(ln, "Can your terminal display ANSI Insert/Delete lines? ", 1, 1) = 0 then SetSimpleTerm 1
  75.                     SendModem CRLF
  76.                     SendModem CRLF
  77.                     end
  78.                 SetTerminalLines AskInput(ln, "Terminal lines: ", "24", 3, "NUMERIC")
  79.                 SendModem CRLF
  80.                 CSet = ""
  81.                 do while CSet = ""
  82.                     SendModem CRLF
  83.                     SendASCII "Text/CharSet.txt"
  84.                     CSet = AskInput(ln, "Select: ", "", 2, "NUMERIC")
  85.                     select
  86.                         when CSet = "0" then CSet = "ISO"
  87.                         when CSet = "1" then CSet = "IBM"
  88.                         when CSet = "2" then CSet = "SF7"
  89.                         when CSet = "3" then CSet = "ISOSF7"
  90.                         when CSet = "4" then CSet = "IBMSF7"
  91.                         otherwise CSet = ""
  92.                         end
  93.                     end
  94.                 SetUserCharSet CSet
  95.                 SendModem CRLF
  96. /*                if GetYesNo(ln, "Use short menus? ", 1, 1) then MenuType = ".etxt" */
  97. /*                else MenuType = ".txt" */
  98.                 MenuType = ".etxt"
  99.                 SendModem CRLF
  100.                 SetUserExtension MenuType
  101.                 SendModem CRLF
  102.                 call SetUserMisc ln, "MSGCHECK", GetYesNo(ln, "Message check every logon? ", 1, 1)
  103.                 SendModem CRLF
  104.                 call SetUserMisc ln, "FILECHECK", GetYesNo(ln, "New files check every logon? ", 1, 1)
  105.                 SendModem CRLF
  106.                 call SetUserMisc ln, "LASTFSCAN", GetDateVal(ln)
  107.                 Protocol = ""
  108.                 do while Protocol = ""
  109.                     SendModem CRLF
  110.                     SendASCII "Text/Protocol.Txt"
  111.                     Protocol = Upper(AskInput(ln, "Select: ", "", 2))
  112.                     select
  113.                         when Protocol = "Z" then Protocol = "ZModem"
  114.                         when Protocol = "8" then Protocol = "ZModem8k"
  115.                         end
  116.                     end
  117.                 SetUserProtocol Protocol
  118.                 SendASCII "Text/Password.txt"
  119.                 Password = ""
  120.                 do while Password = ""
  121.                     Password = AskInput(ln, "Enter password to use: ", "", 16, "SECURE")
  122.                     SendModem CRLF
  123.                     Pwv = AskInput(ln, "Enter again for verification: ", "", 16, "SECURE")
  124.                     SendModem CRLF
  125.                     if Password ~= Pwv then Password = ""
  126.                     end
  127.                 SetPassword Password
  128.                 SetAccessPreset "User/Preset/NewUser.acc"
  129.                 SetUserName UserName
  130.                 SaveUser
  131.                 LogEntry "New User: "||UserName
  132.                 DoneLogOn
  133.                 LogEntry GetUserName(ln)||" logged on"
  134.                 SetStatus "Logged on"
  135.                 SendASCII "Text/LoggedOn.txt"
  136.                 call 'BBS:Rexx/BBSLogOnExtra.rexx' ln
  137.                 address command
  138. /*                "BBS:Bin/TechMenu "||ln||" BBS:Menu/MainMenu.menu" */
  139. /*                call 'BBS:Rexx/BBSGoodbye.rexx' ln */
  140.                 exit 0
  141.                 end
  142.             else do
  143.                 if retry > 5 then do
  144.                     Disconnect
  145.                     exit 10
  146.                     end
  147.                 end
  148.             end
  149.         else do
  150.             Password = AskInput(ln, "Enter password: ", "", 16, "SECURE")
  151.             if CheckPassword(ln, Password) ~= 1 then do
  152.                 SendModem CRLF||"Invalid password"||CRLF||CRLF
  153.                 LogEntry "Password failure for "||GetUserName(ln)
  154.                 ClearUser
  155.                 UserName = ""
  156.                 retry = retry + 1
  157.                 if retry > 2 then do
  158.                     Disconnect
  159.                     exit 10
  160.                     end
  161.                 end
  162.             else do
  163.                 LogEntry "It's "||GetUserName(ln)
  164.                 DoneLogOn
  165.                 LogEntry GetUserName(ln)||" logged on"
  166.                 SetStatus "Logged on"
  167.                 SendASCII "Text/LoggedOn.txt"
  168.                 call 'BBS:Rexx/BBSLogOnExtra.rexx' ln
  169.                 address command
  170. /*                "BBS:Bin/TechMenu "||ln||" BBS:Menu/MainMenu.menu" */
  171. /*                call 'BBS:Rexx/BBSGoodbye.rexx' ln */
  172.                 exit 0
  173.                 end
  174.             end
  175.         end
  176.     end
  177.